﻿//#undef DEBUG
//#define DEBUG

#define MYTEST1
#define MYTEST2

using System.Diagnostics;

namespace _36_C_中预处理命令关键字
{
    internal class Program
    {
        #region 定义字段
        private string name;
        private string description;
        private int age;
        #endregion

        static void Main(string[] args)
        {
            Console.Title = "C#中预处理命令关键字";
            //编译的时候起作用 但是不生成可执行的文件
            //#if DEBUG
            //            global::System.Console.WriteLine("这是Debug");
            //#endif

            //#if MYTEST1 
            //            global::System.Console.WriteLine("这是Mytest1");
            //#elif MYTEST2
            //            global::System.Console.WriteLine("这是Mytest2");
            //#endif

            //#if MYTEST1&&MYTEST2
            //            Console.WriteLine("这是MYTEST1和MYTEST2");
            //#endif
            //show();

            //#line 200
            //#warning "这里是个警告"

            //#line default
            //#error "这是一个错误"

#if NETFRAMEWORK
        Console.WriteLine("运行在 .NET Framework");
#elif NETCOREAPP
            Console.WriteLine("运行在 .NET Core");
#elif NET5_0
        Console.WriteLine("运行在 .NET 5");
#elif NET6_0
        Console.WriteLine("运行在 .NET 6");
#else
        Console.WriteLine("未知的框架");
#endif
            Console.ReadKey();

        }
        [Conditional("MYTEST1"), Conditional("MYTEST2")]//预处理方法
        public static void show()
        {
            Console.WriteLine("mytest1或者mytetst2");
        }
    }
}
